package merge;
import org.apache.hadoop.io.WritableComparable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class MergeBean implements WritableComparable<MergeBean> {
    private int number;
    private int position;

    //默认无参构造
    public MergeBean() {
    }

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeInt(this.number);
    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {
        this.number = dataInput.readInt();
    }

    @Override
    public String toString() {
        return position +
                "\t" + number;
    }

    @Override
    public int compareTo(MergeBean o) {
        if (o.getNumber() > this.number) {
            return -1;
        } else {
            return 1;
        }
    }
}
